#include "MCParametricDrawWindow.h"
#include <iostream>
#include <MCCanvas.h>

MCParametricDrawWindow::MCParametricDrawWindow(MCCommand *command_) :
    command(command_)
{
    setGeometry(0, 0, 200, 410);
    setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowTitleHint);
    setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);

    applyButton = new QPushButton("apply button", this);
    terminateButton = new QPushButton("terminate button", this);

    applyButton->setFixedWidth(width() / 2);
    applyButton->move(0, 380);
    connect(applyButton, &QPushButton::pressed, this, &MCParametricDrawWindow::applyButtonClicked);

    terminateButton->setFixedWidth(width() / 2);
    terminateButton->move(width() / 2, 380);
    connect(terminateButton, &QPushButton::pressed, this, &MCParametricDrawWindow::terminateButtonClicked);
}

MCParametricDrawWindow::~MCParametricDrawWindow()
{
    delete applyButton;
    delete terminateButton;
}

void MCParametricDrawWindow::terminateButtonClicked()
{
    command->terminate();
    close();
}

void MCParametricDrawWindow::applyButtonClicked()
{
    command->finalize();
    close();
}
